const args = process.argv || [];
// 获取启动参数
const getArgv = key => args.find((item, index, array) => index > 0 && array[index - 1] === `-${key}`);
const checkArgv = key => !!args.some(str => str === "-" + key);

const serverConstant = {
	i18nVersion: Date.now().toString(),
	prodMode: process.env.NODE_ENV === "production",
	devMode: process.env.NODE_ENV === "development",
	logMode: checkArgv('log'),
	port: getArgv('port') || 8888,
	getArgv,
	checkArgv,
};

module.exports = serverConstant;
